n = 20;alpha = 0.01;
# x = rnorm(n, mean=10.5, sd=1.3);
x = c(7.26524405244157, 11.0841860757083, 9.85254582407979, 10.132722916065, 
    12.6178471810217, 11.1766277814831, 11.7392634508947, 10.2496063454017, 
    13.1558245839216, 13.2916850865925, 8.01587662213529, 9.94178218156285, 
    10.7285791404259, 8.23325958317138, 10.8366448975267, 12.0093616002831, 
    10.1752356414303, 10.4240485101049, 10.2879503885023, 11.6609297957832
);

hypothesisTest = t.test(x, mu=10 ,conf.level = 1-alpha);
print(hypothesisTest); # Printing of the result is useful if you execute a script file 

criticalValue = qt(alpha/2,df=n-1,lower.tail=FALSE)
xBar = mean(x)
stdDev = sd(x)
shift = criticalValue * stdDev / sqrt(n) 
c(xBar - shift , xBar + shift)


#
tStat = ((xBar - 10) / stdDev) * sqrt(n)
criticalValue = qt(1-alpha/2,df=n-1)
tStat
criticalValue

dist = pt(tStat, df=n-1, lower.tail = TRUE, log.p = FALSE)
minAlpha = (1-dist)*2
minAlpha